<style>body{background: #f6f6f6;}.tableinfo{display:none !important;}table.dataTable tbody th, table.dataTable tbody td{padding:0;border:none;}#subUser{border:none;} </style>
<div class="wapper" id="lowerManage">
	<div class="col-xs-12 col-sm-4 col-sm-offset-4 text-center" style="color:white;background: #059BF3;height: 50px;line-height:50px;position: fixed;margin-top: 0px;left: 0px;z-index: 100;padding-left:0;padding-right:0;">
		<a  class="glyphicon glyphicon-chevron-left fl" onclick="backPage()" style="cursor:pointer; color: white;position:absolute;top:50%;transform:translateY(-50%);font-size: 20px;left:10px;"></a>
		<span style="font-size: 16px;">下级管理</span>
	</div>
	<div data-v-5ba06bde="" class="col-xs-12 col-sm-4 col-sm-offset-4 main child-view" s="[object Object]">
	<div data-v-5ba06bde="" class="search"><input data-v-5ba06bde="" type="text" placeholder="请输入下级账号"><span data-v-5ba06bde="">搜索</span></div>
	<div data-v-5ba06bde="" class="ag-top">
		<div data-v-5ba06bde="" class="name-num">
			<div data-v-5ba06bde="" class="lt">我的下级</div>
			<!-- <div data-v-5ba06bde="" class="rt"><span data-v-5ba06bde="" class="sp1 on">注册时间<i data-v-5ba06bde="" class="defFont"></i></span><span data-v-5ba06bde="" class="sp2">等级<i data-v-5ba06bde="" class="defFont"></i></span></div> -->
		</div>
	</div>
	<div data-v-5ba06bde="">
		<table class="class-tableDataTable class-table-needClick display table table-striped table-bordered table-hover" id="subUser">
				<thead style="display:none;">
					<tr>
					</tr>
				</thead>
				<tbody></tbody>
			</table>
	</div>
	<!-- <div data-v-5ba06bde="" class="msg loadingMsg" style="padding: 1.5em 0px;"></div> -->
	<!---->
</div>
	
</div>
<script>
$(".foot").hide();
var searchName="";
var userName="";

function datatable01(){
	$("#subUser").DataTable({
	    "bLengthChange": true,      
	    "bSort": false,
	    "bAutoWidth": false,
	    'aLengthMenu':[5],
	     "searching": false,
	     "dom": `ftp`,
	     "language": {
	          "lengthMenu": "每页显示 _MENU_ 条记录",     
	          "zeroRecords": "没有检索到数据",     
	          "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",     
	          "info": "没有数据",     
	          "oPaginate": {     
	              "sFirst": "首页",     
	              "sPrevious": "前一页",     
	              "sNext": "后一页",     
	              "sLast": "尾页"    
	        	},
	          "search":"搜索:",
	          "infoFiltered":   "(从  _MAX_ 记录中搜索出结果)",
	          "infoEmpty":      "没有找到匹配的信息",
	       },
	       "ajax": {
	      	 "type": "POST",
	      	 "url":"/agencyCenter/subordinate.do",
	      	"data": function ( d ) {
		        d.name = searchName;
		        d.cname=userName;
		    },
	      	 "dataSrc": function(json) {
	      		 var newData = json.data;
	      		 console.log(newData);
	      		/*  if(newData==""){
	      			 $(".dataTables_empty").hide();
	      		 }else{
	      			 $(".dataTables_empty").show(); 
	      		 } */
	      		 
	      		 if(newData.length<=5){
	      			 $(".paging_simple_numbers").hide();
	      			/*  $(".loadingMsg").text("已显示全部数据") */
	      		 }else{
	      			 $(".paging_simple_numbers").show(); 
	      			/* $(".loadingMsg").text("") */
	      		 }
	      		 
	      		 for(i=0;i<newData.length;i++){
	      			 var item=newData[i];
	      			 if(item.gamePlayer==0){
	      				item.gamePlayer="玩家";
	      			 }
	      			 if(item.gamePlayer==1){
	      				item.gamePlayer="代理";
	      			 }
	      			if(item.gamePlayer==null){
	      				item.gamePlayer="";
	      			}
	      			 var odds=item.odds;
	      			 odds=(odds*100).toFixed(1)+"%";
	      			 item.content="<div data-v-5ba06bde='' class='member'>"+
	      			"<i data-v-5ba06bde='' class='defFont'></i>"+
	      			"<p data-v-5ba06bde=''>"+item.name+"</p>"+
	      			"<em data-v-5ba06bde=''>返点率："+odds+"</em>"+
	      		"</div>"+
	      		"<div data-v-5ba06bde='' class='detail' style='display:none'>"+
	      			"<div data-v-5ba06bde='' class='info-border'>"+
	      				/* "<div data-v-5ba06bde='' class=info reb'><span data-v-5ba06bde=''>累计返佣：</span><span data-v-5ba06bde='' class='s2'></span></div>"+ */
	      				"<div data-v-5ba06bde='' class='info money'><span data-v-5ba06bde=''>当前余额：</span><span data-v-5ba06bde='' class='s2'>"+item.balance+"元</span></div>"+
	      				"<div data-v-5ba06bde='' class='info reg'><span data-v-5ba06bde=''>注册时间：</span><span data-v-5ba06bde='' class='s2'>"+item.registerTime+"</span></div>"+
	      				"<div data-v-5ba06bde='' class='info log'><span data-v-5ba06bde=''>最后登录：</span><span data-v-5ba06bde='' class='s2'>"+item.lastTime+"</span></div>"+
	      				"<div data-v-5ba06bde='' class='info tp'><span data-v-5ba06bde=''>用户类型：</span><span data-v-5ba06bde='' class='s2'>"+item.gamePlayer+"</span></div>"+
	      				"<div data-v-5ba06bde='' class='info'><span data-v-5ba06bde='' class='btn'>查看下级</span></div>"+
	      			"</div>"+
	      		"</div>";
	      		 }
	      		 return newData;
	      	 }
	       },	
	        "columns": [
				           { "data": "content","className":" content-td"},
	               ]        
	 	});	
	}
	datatable01();	
	 		 
 	/* 点击查看用户详情 */
 	$("#subUser").on("click",".member",function(){
 		if($(this).hasClass("on")){
 			$(".member").removeClass("on");
 			$(".detail").hide();
 		}else{
 			$(".member").addClass("on");
 			$(this).next().show();
 			$(this).parents("tr").siblings().find(".member").removeClass("on");
 			$(this).parents("tr").siblings().find(".detail").hide();
 		}
 	});
 	
 	/* 点击搜索框搜索 */
 	$(".search span").on("click",function(){
 		if($(".search input").val()==""){
 			return;
 		}else{
 			searchName=$(".search input").val();
 			/* datatable01(); */
 			$("#subUser").DataTable().ajax.reload();
 		}
 	});
 	
 	/* 查看下级 */
 	$("#subUser").on("click",".btn",function(){
 		userName=$(this).parents(".detail").prev().find("p").text();
 		$("#subUser").DataTable().ajax.reload();
 		$(".name-num .lt").text(userName+"的下级");
 	});
 	

/* dataTable01(); */
</script>